#ifndef STLMAINWINDOW_H
#define STLMAINWINDOW_H

#include <memory>

#include <QDir>
#include <QMessageBox>
#include <QFileDialog>
#include <QVBoxLayout>

#include <QMainWindow>

#include <QStandardPaths>

#include "STLReader.h"
#include "stlmodelwidget.h"
#include "slicemainwindow.h"
#include "slicingsettingsdialog.h"

namespace Ui {
class STLMainWindow;
}

class STLMainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit STLMainWindow(QWidget *parent = nullptr);
    ~STLMainWindow();

public:
    void iniUI();
    void initModelWidget();
    void updateCurrentFileLabel(const QString& stl_file_path);
    void createSlicingWindow(SliceInfo slice_info);

private:
    void handleSlicingSettings(const QVector3D &planeNormal, float cameraDistance, float slicingStride);

private slots:
    void on_actionOpenSTL_triggered();
    void on_actionSliceModel_triggered();
    void on_actionSetupSliceInfo_triggered();

    void on_actionSaveAs_triggered();

    void on_pushButton_clicked();

private:
    std::shared_ptr<STLReader> m_sp_stl_reader;
    std::shared_ptr<STLModelWidget> m_sp_modelWidget;
    std::shared_ptr<SliceMainWindow> m_sp_sliceWidget;
    std::shared_ptr<SlicingSettingsDialog> m_sp_slicingSettingDialog;

private:
    Ui::STLMainWindow *ui;
    QLabel *fLabCurFile;
};

#endif // STLMAINWINDOW_H
